package com.example.planetandzombiedemo.entity;

import android.graphics.Canvas;
import android.graphics.Paint;

import com.example.planetandzombiedemo.model.BaseModel;
import com.example.planetandzombiedemo.view.GameView;

public class ZombieManager extends BaseModel {
    //不显示的类，用于控制产生Zombie
    private long lastBirthTime;

    public ZombieManager() {
        lastBirthTime = System.currentTimeMillis();
    }

    @Override
    public void drawSelf(Canvas canvas, Paint paint) {
        if (System.currentTimeMillis() - lastBirthTime > 1500) {
            lastBirthTime = System.currentTimeMillis();
            giveBirth2Zombie();
        }
    }

    @Override
    public int getModelWidth() {
        return 0;
    }

    private void giveBirth2Zombie() {
        GameView.getInstance().apply4Zombie();
    }

}
